package springRepo.Library;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import springRepo.Library.domain.book.Book;
import springRepo.Library.repository.book.BookRepository;

public class Main {

	private static ApplicationContext appCtx;

	public static void main(String[] args) {
        appCtx = new ClassPathXmlApplicationContext("persistenceContext.xml");
        
        BookRepository repository = appCtx.getBean("bookRepository", BookRepository.class);
        List<Book> books = repository.findAll();
        for (Book book : books) {
            System.out.println(book);
        }
        
        Book book = repository.findByName("book1");
        System.out.println(book);

    }
}
